;================================================================================
; Castlevania: Dracula X Notes:
;================================================================================

$7E:0078 = StageID  ; (6 = stage 7)
$7E:007A = SubArea  ; (8 = final boss)

;================================================================================

; $82898C ($01098C)
; compressed data loading (final boss room)
db $01, $80           ; ???
dl $A8EB17            ; bg1 layout  (32x32 blocks)
dl $A99B5A | $400000  ; bg1 tilemap (tile numbers)
dl $A99D0F | $400000  ; bg1 tilemap (tile properties)
dl $A8ED9E            ; bg2 layout  (32x32 blocks)
dl $A99DD2 | $400000  ; bg2 tilemap (tile numbers)
dl $A9A27C | $400000  ; bg2 tilemap (tile properties)
dw $FFFF              ; endflag


; $828AC8 ($010AC8)
; compressed data loading collision mask (final boss room)
db $01, $00  ; ???
dl $7F6000   ; final destination (collision definitions)
dl $95857E   ; bg tile collision definitions
dl $7F7000   ; final destination (index to collision)
dl $95857E   ; index to collision (val << 4)
dw $FFFF     ; endflag


;================================================================================
; compressed data format
;================================================================================
2-bytes = compressed data size


; ex: A8586 = [2B EF]
(ctrl_val < $80) = copy bytes from output buffer
	* ((val_1 >> 2) + 2) = # bytes to copy
	* ((val_2 = 2-bytes,big-end - $03DF) & $03FF) = pos in output buffer to copy from

; ex: A8581 = [81 01]
(ctrl_val < $A0) = copy bytes as is
	* (val & $1F) = # bytes to copy from input buffer
	
; ex: A85A7 = [A2 04 00 00 0E]
(ctrl_val < $C0) = write bytes with leading zeros
	* ((val & $1F) + 2) = # bytes to copy, write 0 before each byte
	
; ex: A858A = [C2 02]
(ctrl_val < $E0) = repeater byte
	* ((val & $1F) + 2) = # times to write next byte

; ex: A8580 = [EE]
(ctrl_val < $FF) = write 0 to buffer
	* ((val & $1F) + 2) = # times to write 0 byte
	
; ex: A94B8 = [FF 38] (different file)
(ctrl_val = $FF) = repeat last byte from output buffer
	* (val) = # times to write last byte


;================================================================================


; edit map layout (32x32 blocks)
$7F4A10 = 17 16 00 00 00 1E 00 00 00 1E 00 00 00 00 2A 2A
$7F4A90 = 20 18 00 19 00 23 00 20 00 23 00 19 00 00 29 00
$7F4B10 = 22 1A 2B 25 2B 25 2B 22 2B 25 2B 25 2B 2B 1A 2B

; add collision to pits (left to right)
$7F7A10 = 04 1F 00 00 00 20 00 00 00 20 00 00 00 00 00 05
$7F7A90 = 20 01 00 1F 00 01 00 20 00 01 00 1F 00 00 1F 05
$7F7B10 = 04 01 1F 01 1F 01 1F 01 1F 01 1F 01 1F 1F 21 1F
